package com.notes.controller;

import com.notes.config.api.ApiResult;
import com.notes.config.controller.BaseController;
import com.notes.domain.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author: huxingxin
 * @date: 2024/7/3
 */
@RestController
@RequestMapping("/user")
@Api(tags = "用户管理")
public class UserController extends BaseController {

    @GetMapping("getUserList")
    @ApiOperation("查询用户列表")
    public ApiResult<User> getUserList(){
        User user = new User();
        user.setId(1746822928126840832L);
        user.setName("叽叽喳喳");
        user.setSex("女");
        user.setAge(20);
        user.setCreateTime(new Date());
        user.setUpdateTime(LocalDateTime.now());
        StringUtils.hasText("");
        return success(user);
    }

    @PostMapping("addUserPost")
    @ApiOperation("新增用户")
    public ApiResult<User> addUserPost(@RequestBody User user){
        return success(user);
    }

    @GetMapping("addUserGet")
    @ApiOperation("新增用户")
    public ApiResult<User> addUserGet(User user){
        return success(user);
    }
}
